//
//  YGPayView.m
//  yuanshangyiliao
//
//  Created by icholab on 2021/4/15.
//

#import "YGPayView.h"

@interface YGPayView ()

@property (nonatomic, strong) UIButton *selectAllBtn;
@property (nonatomic, strong) UIButton *selectAllLabelBtn;
@property (nonatomic, strong) UILabel *totalLabel;
@property (nonatomic, strong) UILabel *moneyShowLabel;
@property (nonatomic, strong) UIButton *payBtn;
@end

@implementation YGPayView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView];
        [self initconstraints];
    }
    return self;
}

-(void)initView{
    [self addSubview:self.selectAllBtn];
    [self addSubview:self.selectAllLabelBtn];
    [self addSubview:self.totalLabel];
    [self addSubview:self.moneyShowLabel];
    [self addSubview:self.payBtn];
}

-(void)initconstraints{
    [self.selectAllBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.left.mas_equalTo(self.mas_left).offset(5);
            make.width.mas_equalTo(12);
            make.height.mas_equalTo(12);
    }];
    
    [self.selectAllLabelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.left.mas_equalTo(self.selectAllBtn.mas_right).offset(5);
            make.width.mas_equalTo(50);
            make.height.mas_equalTo(12);
    }];
    
    [self.totalLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.left.mas_equalTo(self.selectAllLabelBtn.mas_right).offset(130);
            make.width.mas_equalTo(30);
            make.height.mas_equalTo(12);
    }];
   
    [self.moneyShowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.mas_equalTo(self.mas_centerY);
            make.left.mas_equalTo(self.totalLabel.mas_right).offset(5);
            make.width.mas_equalTo(50);
            make.height.mas_equalTo(10);
    }];
    
    [self.payBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.right.mas_equalTo(self);
             make.width.mas_equalTo(50);
            
    }];
}

#pragma setter
- (UIButton *)selectAllBtn{
    if (!_selectAllBtn) {
        _selectAllBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_selectAllBtn setBackgroundImage:[UIImage imageNamed:@"gender_btn_icon"] forState:UIControlStateNormal];
        [_selectAllBtn setBackgroundImage:[UIImage imageNamed:@"gender_selected_btn_icon"] forState:UIControlStateSelected];
        _selectAllBtn.selected = NO;
    }
    return _selectAllBtn;
}
- (UIButton *)selectAllLabelBtn{
    if (!_selectAllLabelBtn) {
        _selectAllLabelBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_selectAllLabelBtn setTitle:@"全选" forState:UIControlStateNormal];
        [_selectAllLabelBtn setTitle:@"取消全选" forState:UIControlStateSelected];
        _selectAllLabelBtn.titleLabel.font = [UIFont systemFontOfSize:12];
        _selectAllLabelBtn.selected = NO;
    }
    return _selectAllLabelBtn;
}

- (UILabel *)totalLabel{
    if (!_totalLabel) {
        _totalLabel = [[UILabel alloc]init];
        _totalLabel.text = @"合计：";
        _totalLabel.textColor = UIColorFromRGB(0x333333);
        _totalLabel.font = [UIFont systemFontOfSize:12];
    }
    return _totalLabel;
}

- (UILabel *)moneyShowLabel{
    if (!_moneyShowLabel) {
        _moneyShowLabel = [[UILabel alloc]init];
        _moneyShowLabel.text = @"￥0.00";
        _moneyShowLabel.textColor = UIColorFromRGB(0xE55667);
        _moneyShowLabel.font = [UIFont systemFontOfSize:12];
    }
    return _moneyShowLabel;
}
- (UIButton *)payBtn{
    if (!_payBtn) {
        _payBtn = [[UIButton alloc]init];
        _payBtn.backgroundColor = UIColorFromRGB(0xE55667);
        [_payBtn setTitle:@"结算(0)" forState:UIControlStateNormal];
        _payBtn.titleLabel.font = [UIFont systemFontOfSize:13];
        [_payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    }
    return _payBtn;
}
@end
